<? 
include"../inc/config.inc.php";
if($_POST[MODE]=="ADD")
{
$subject_id=$_POST[subject_id];
$subject=$_POST[subject];
$subject_unit=$_POST[subject_unit];
$sql="insert into subject (subject_id,subject,subject_unit) values('$subject_id','$subject','$subject_unit')";
mysql_query($sql) or die (mysql_error());
echo"<meta http-equiv='refresh' content='0;URL=subject.php'>";
}
if($_GET[MODE]=="DEL")
{
$subject_id=$_GET[subject_id];
$subject=$_GET[subject];
$subject_unit=$_GET[subject_unit];
$sql="delete from subject where subject_id='$subject_id'";
mysql_query($sql) or die (mysql_error());
echo"<meta http-equiv='refresh' content='0;URL=subject.php'>";
}
if($_POST[MODE]=="EDIT")
{
$subject_id=$_POST[subject_id];
$subject=$_POST[subject];
$subject_unit=$_POST[subject_unit];
$sql="UPDATE subject set subject_id='$subject_id',subject='$subject',subject_unit='$subject_unit' where subject_id='$subject_id'";
mysql_query($sql) or die(mysql_error());
echo"<meta http-equiv='refresh' content='0;URL=subject.php'>";
}
?>